<template>
  <div>
    <div style="margin-bottom:10px">选中项的id：{{selectId}} 默认为0(全部),需在数据添加全部项</div>
    <search-select style="width:200px"
                   keyName="name"
                   :list="list"
                   :selectId="selectId"
                   @setListId="setListId"
                   placeholderTip="请选择"></search-select>
  </div>
</template>
  
<script>
export default {
  data () {
    return {
      selectId: 0,
      list: [{
        id: 1,
        name: '张三',
      }]
    }
  },
  methods: {
    setListId (id) {
      if (id || id === 0) {
        this.selectId = id
      }
    },
  }
}
</script>